package com.wtwd.campus.vcom.utils;

import com.wtwd.campus.service.RedisService;

/**
 * @Author: ldaoliang
 * @DateTime: 2022/1/5 9:19
 * @Description:
 */
public class CommandNumberUtils {

    public static String generateCommandNumber(RedisService redisService,String imei){
        long count = redisService.getCommandNumberByImei(imei);
        count = count % 86400;
        long hours = count / 3600;
        long minutes = (count - 3600 * hours) / 60;
        long seconds = count - 3600 * hours - 60 * minutes ;
        String hourStr = hours < 10 ? "0" + hours : String.valueOf(hours);
        String minuteStr = minutes < 10 ? "0" + minutes : String.valueOf(minutes);
        String secondStr = seconds < 10 ? "0" + seconds : String.valueOf(seconds);
        return hourStr + minuteStr + secondStr;
    }

}
